package [package].controller.v1;

import  [package].service.[Table2]Service;
import  [path_1].[path_2].apis.[path_3].[Table2]ControllerApi;
import  [path_1].[path_2].model.[path_3].dtos.[Table2]Dto;
import  [path_1].[path_2].model.[path_3].pojos.[Table2];
import  [path_1].[path_2].model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Description:
 * @Version: V1.0
 */
@RestController
@RequestMapping("/api/v1/[table2]")
public class [Table2]Controller implements [Table2]ControllerApi {

    @Autowired
    [Table2]Service [table2]Service;


    /**
     * 查询列表
     * @param dto
     * @return
     */
    @PostMapping("list")
    @Override
    public ResponseResult findPage(@RequestBody [Table2]Dto dto) {
        return [table2]Service.findPage(dto);
    }

    /**
     * 新增
     *
     * @param [table2]
     * @return
     */
    @PostMapping("/save")
    @Override
    public ResponseResult save(@RequestBody [Table2] [table2]) {
        return [table2]Service.insert([table2]);
    }

    /**
     * 修改
     * @param [table2]
     * @return
     */
    @Override
    @PostMapping("/update")
    public ResponseResult update(@RequestBody [Table2] [table2]) {
        return [table2]Service.update([table2]);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    @GetMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable("id") [keyType] [key2]) {
        return [table2]Service.deleteById(id);
    }
}
